<!DOCTYPE html>
<html lang='en'>

<head>
  <meta charset='UTF-8'>
  <meta http-equiv='X-UA-Compatible' content='IE=edge'>
  <meta name='viewport' content='width=device-width, initial-scale=1.0'>
  <title>Document</title>
</head>

<body>
  <h2>结果在控制台~~</h2>
  路径：<input type="text" id="input1">
  <br>
  <br>
  内容：<textarea name="" id="textarea1" cols="30" rows="10"></textarea>
  <br>
  <br>
  <button type="button" onclick="GET()">GET</button></button>
  <button type="button" onclick="PATCH()">PATCH</button></button>
  <button type="button" onclick="POST()">POST</button></button>
  <button type="button" onclick="DELETE()">DELETE</button></button>

  <script src="./jsonbin.js"></script>
  <!-- <script src="./jsonbin.min.js"></script> -->
  <script>
    let input1 = document.getElementById("input1")
    let textarea1 = document.getElementById("textarea1")

    const jsonbin = new JsonBin('zzwuweijun', 'cadcbc89-6ddd-4892-a490-cbd9f253a750')

    function GET() {
      jsonbin.get(input1.value).then(s => console.log(`GET`, s))
    }
    function PATCH() {
      jsonbin.patch(input1.value, textarea1.value ).then(s => console.log(`PATCH`, s))
      // jsonbin.patch(input1.value, "undefined").then(s => console.log(`PATCH`, s))
      // jsonbin.patch(input1.value, [32, 'jo', 'j3'] ).then(s => console.log(`PATCH`, s))
      // jsonbin.patch(input1.value, {ll:324, pp:'djfi'}).then(s => console.log(`PATCH`, s))
      // jsonbin.patch(input1.value, undefined).then(s => console.log(`PATCH`, s))
      // jsonbin.patch(input1.value, "undefined").then(s => console.log(`PATCH`, s))
      // jsonbin.patch(input1.value, null).then(s => console.log(`PATCH`, s))
      // jsonbin.patch(input1.value, "null").then(s => console.log(`PATCH`, s))
      // jsonbin.patch(input1.value, false).then(s => console.log(`PATCH`, s))
      // jsonbin.patch(input1.value, 1234).then(s => console.log(`PATCH`, s))
    }
    function POST() {
      jsonbin.post(input1.value, textarea1.value).then(s => console.log(`POST`, s))
    }
    function DELETE() {
      jsonbin.delete(input1.value).then(s => console.log(`DELETE`, s))
    }
  </script>

</body>

</html>